﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using VRacer;
using System.Windows;

namespace VRacer.Controls
{
    public class PlayersListTemplateSelector : DataTemplateSelector
    {
        public override DataTemplate SelectTemplate(object item, System.Windows.DependencyObject container)
        {
            if (container is FrameworkElement)
            {
                var control = (FrameworkElement)container;
                if (item is AIPlayer)
                    return (DataTemplate)control.FindResource("AIPlayerDetailsTemplate");
                else if (item is HumanPlayer)
                    return (DataTemplate)control.FindResource("HumanPlayerDetailsTemplate");
                else return null;
            }
            else
                return null;
        }
    }
}
